import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '../views/Layout/Layout.vue'
import Commodity from '../views/Commodity'
import Error from '../views/Error'
import Login from "../views/Login"
import Personal from "../views/Personal"
import Specification from "../views/Specification"
import Advert from "../views/AD/Advert.vue"


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Layout',
    redirect: "/commodity",
    component: Layout,
    children: [
      {
        path: 'commodity',
        name: 'Commodity',
        component: Commodity,
      },
      {
        path: 'personal',
        name: 'Personal',
        component: Personal,
      },
      {
        path: 'specification',
        name: 'Specification',
        component: Specification,
      },
      {
        path: 'advert',
        name: 'Advert',
        component: Advert,
      }
    ],
    meta: {
      isLogin: true,
    }
  },
  {
    path: '*',
    name: 'Error',
    component: Error,
  },
  {
    path: '/login',
    name: 'Login',
    component: Login,
  },

]
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})



export default router
